{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}G:\My Drive\ROI\UCDavis\Dissertation\Chapter 2\BJPS\Replication\Stuck_in_the_Middle_simulation_log.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}23 Apr 2019, 15:52:32
{txt}
{com}. * Labels for outliers
. gen p_year = "FDP 2009" if cyear==4 & party ==1
{txt}(73 missing values generated)

{com}. replace p_year = "Die Linke 2009" if cyear==4 & party==4
{txt}variable {bf}p_year{sf} was {bf}{res}str8{sf}{txt} now {bf}{res}str14{sf}
{txt}(1 real change made)

{com}. replace p_year = "Canadian Green 2008" if cyear==1 & party==5
{txt}variable {bf}p_year{sf} was {bf}{res}str14{sf}{txt} now {bf}{res}str19{sf}
{txt}(1 real change made)

{com}. replace p_year = "Labour 2017" if cyear==9 & party==3
{txt}(1 real change made)

{com}. 
. * Create dummy variables center group v each separate group
. recode party (1=1) (2=0) (else=.), gen(c_right) 
{txt}(62 differences between party and c_right)

{com}. recode party (1=1) (3=0) (else=.), gen(c_left)
{txt}(62 differences between party and c_left)

{com}. recode party (1=1) (4=0) (else=.), gen(c_other_l)
{txt}(62 differences between party and c_other_l)

{com}. recode party (1=1) (5=0) (else=.), gen(c_green)
{txt}(62 differences between party and c_green)

{com}. recode party (1=1) (6=0) (else=.), gen(c_p_right)
{txt}(62 differences between party and c_p_right)

{com}. 
. * Testing differences in gains from positioning (results presented in Figure 2)
. ttest gain, by(c_right)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}     12{col 22} 6.881749{col 34} 1.262596{col 46}  4.37376{col 58} 4.102795{col 70} 9.660704
       {txt}1 {c |}{res}{col 12}     12{col 22} .7106001{col 34} .2157954{col 46} .7475372{col 58} .2356376{col 70} 1.185563
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     24{col 22} 3.796175{col 34} .8979375{col 46} 4.398977{col 58}  1.93865{col 70}   5.6537
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} 6.171149{col 34} 1.280904{col 58} 3.514716{col 70} 8.827582
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  4.8178
{txt}Ho: diff = 0                                     degrees of freedom = {res}      22

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}1.0000         {txt}Pr(|T| > |t|) = {res}0.0001          {txt}Pr(T > t) = {res}0.0000
{txt}
{com}. ttest gain, by(c_left)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}     12{col 22} 3.018334{col 34}  .874149{col 46} 3.028141{col 58} 1.094344{col 70} 4.942323
       {txt}1 {c |}{res}{col 12}     12{col 22} .7106001{col 34} .2157954{col 46} .7475372{col 58} .2356376{col 70} 1.185563
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     24{col 22} 1.864467{col 34} .5017483{col 46} 2.458055{col 58} .8265213{col 70} 2.902412
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} 2.307733{col 34} .9003911{col 58} .4404365{col 70}  4.17503
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  2.5630
{txt}Ho: diff = 0                                     degrees of freedom = {res}      22

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.9911         {txt}Pr(|T| > |t|) = {res}0.0177          {txt}Pr(T > t) = {res}0.0089
{txt}
{com}. ttest gain, by(c_other_l)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}     12{col 22} 2.718617{col 34} .8767639{col 46} 3.037199{col 58} .7888723{col 70} 4.648361
       {txt}1 {c |}{res}{col 12}     12{col 22} .7106001{col 34} .2157954{col 46} .7475372{col 58} .2356376{col 70} 1.185563
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     24{col 22} 1.714608{col 34} .4886578{col 46} 2.393924{col 58} .7037428{col 70} 2.725474
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} 2.008017{col 34}   .90293{col 58} .1354544{col 70} 3.880579
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  2.2239
{txt}Ho: diff = 0                                     degrees of freedom = {res}      22

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.9816         {txt}Pr(|T| > |t|) = {res}0.0367          {txt}Pr(T > t) = {res}0.0184
{txt}
{com}. ttest gain, by(c_green)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}     12{col 22} .6904666{col 34} .1039433{col 46}   .36007{col 58} .4616891{col 70} .9192442
       {txt}1 {c |}{res}{col 12}     12{col 22} .7106001{col 34} .2157954{col 46} .7475372{col 58} .2356376{col 70} 1.185563
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     24{col 22} .7005333{col 34} .1171485{col 46} .5739079{col 58} .4581933{col 70} .9428734
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22}-.0201334{col 34} .2395242{col 58}-.5168763{col 70} .4766094
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res} -0.0841
{txt}Ho: diff = 0                                     degrees of freedom = {res}      22

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.4669         {txt}Pr(|T| > |t|) = {res}0.9338          {txt}Pr(T > t) = {res}0.5331
{txt}
{com}. ttest gain, by(c_p_right)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}      8{col 22}   4.4971{col 34} 2.222555{col 46} 6.286334{col 58}-.7584062{col 70} 9.752607
       {txt}1 {c |}{res}{col 12}     12{col 22} .7106001{col 34} .2157954{col 46} .7475372{col 58} .2356376{col 70} 1.185563
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     20{col 22}   2.2252{col 34} .9618968{col 46} 4.301733{col 58}  .211927{col 70} 4.238473
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22}   3.7865{col 34} 1.809098{col 58}-.0142728{col 70} 7.587273
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  2.0930
{txt}Ho: diff = 0                                     degrees of freedom = {res}      18

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.9746         {txt}Pr(|T| > |t|) = {res}0.0508          {txt}Pr(T > t) = {res}0.0254
{txt}
{com}. 
. * Figure 2: Simulated Vote Share Increase from Moving to Vote-Maximizing Position
. graph box gain if party<7, over(party, sort(1))  ///
> box(1, col(black))  marker(1, mcol(black) mlab(p_year) mlabcol(black) mlabposition(12)) ///
> ytitle("Vote Share Increase", c(black) m(r+3)) ylab(,nogrid) ///
> graphregion(color(white)) bgcolor(white) ///
> title("", c(black) j(right))
{res}{txt}
{com}. graph save Graph "Figure_2.gph" ,replace 
{res}{txt}(file Figure_2.gph saved)

{com}. graph export "Figure_2.png", as(png) replace
{txt}(file Figure_2.png written in PNG format)

{com}. 
. * Figure 3: Distance Between Parties’ Perceived and Vote-Maximizing Left-Right Position
. graph box move if party<7, over(party, sort(1))  ///
> box(1, col(black))  marker(1, mcol(black) mlab(p_year) mlabcol(black) mlabposition(12)) ///
> ytitle("Distnace from Vote-Maximizing Position", c(black) m(r+3)) ylab(,nogrid) ///
> graphregion(color(white)) bgcolor(white) ///
> title("", c(black) j(right))
{res}{txt}
{com}. graph save Graph "Figure_3.gph" ,replace 
{res}{txt}(file Figure_3.gph saved)

{com}. graph export "Figure_3.png", as(png) replace
{txt}(file Figure_3.png written in PNG format)

{com}. 
. * Figure 4: Valence and Simulated Vote Share Increase at Vote-Maximizing Position
. scatter gain valence if party==1, msymbol(O) mcol(black) || ///
> scatter gain valence if party==2, msymbol(X) mcol(gray) || ///
> scatter gain valence if party==4, msymbol(+) mcol(gray) || ///
> scatter gain valence if party==3, msymbol(oh) mcol(gray) || ///
> scatter gain valence if party==6, msymbol(d) mcol(gray) ///
> ytitle("Vote Share Increase", c(black) m(r+3)) ylab(,nogrid)  ///
> xtitle("Valence Relative to the Green Party", c(black)) ///
> graphregion(color(white)) bgcolor(white) legend(lab(1 "Center") lab(2 "Moderate Right") lab(3 "Other Left") lab(4 "Major Left") lab(5 "Populist-Right")) ///
> title("", c(black) j(right))
{res}{txt}
{com}. graph save Graph "Figure_4.gph" ,replace 
{res}{txt}(file Figure_4.gph saved)

{com}. graph export "Figure_4.png", as(png) replace
{txt}(file Figure_4.png written in PNG format)

{com}. 
. * Testing differences in gains from valence (results presented in Figure 5)
. ttest gain_v, by(c_right)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}     12{col 22}  17.3915{col 34} .8286434{col 46} 2.870505{col 58} 15.56767{col 70} 19.21533
       {txt}1 {c |}{res}{col 12}     12{col 22} 16.36451{col 34} 1.686195{col 46} 5.841152{col 58} 12.65322{col 70}  20.0758
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     24{col 22}   16.878{col 34} .9249713{col 46} 4.531415{col 58} 14.96455{col 70} 18.79145
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} 1.026991{col 34} 1.878804{col 58} -2.86941{col 70} 4.923392
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  0.5466
{txt}Ho: diff = 0                                     degrees of freedom = {res}      22

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.7049         {txt}Pr(|T| > |t|) = {res}0.5901          {txt}Pr(T > t) = {res}0.2951
{txt}
{com}. ttest gain_v, by(c_left)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}     12{col 22}   18.377{col 34} .4669746{col 46} 1.617648{col 58}  17.3492{col 70}  19.4048
       {txt}1 {c |}{res}{col 12}     12{col 22} 16.36451{col 34} 1.686195{col 46} 5.841152{col 58} 12.65322{col 70}  20.0758
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     24{col 22} 17.37075{col 34} .8809528{col 46}  4.31577{col 58} 15.54836{col 70} 19.19314
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} 2.012492{col 34} 1.749663{col 58}-1.616086{col 70} 5.641071
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  1.1502
{txt}Ho: diff = 0                                     degrees of freedom = {res}      22

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.8688         {txt}Pr(|T| > |t|) = {res}0.2624          {txt}Pr(T > t) = {res}0.1312
{txt}
{com}. ttest gain_v, by(c_other_l)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}     12{col 22} 7.742533{col 34} .8248643{col 46} 2.857414{col 58} 5.927019{col 70} 9.558048
       {txt}1 {c |}{res}{col 12}     12{col 22} 16.36451{col 34} 1.686195{col 46} 5.841152{col 58} 12.65322{col 70}  20.0758
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     24{col 22} 12.05352{col 34} 1.284772{col 46} 6.294073{col 58} 9.395767{col 70} 14.71127
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22}-8.621975{col 34}  1.87714{col 58}-12.51493{col 70}-4.729024
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res} -4.5931
{txt}Ho: diff = 0                                     degrees of freedom = {res}      22

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.0001         {txt}Pr(|T| > |t|) = {res}0.0001          {txt}Pr(T > t) = {res}0.9999
{txt}
{com}. ttest gain_v, by(c_green)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}     12{col 22} 8.849933{col 34}  1.26761{col 46} 4.391129{col 58} 6.059943{col 70} 11.63992
       {txt}1 {c |}{res}{col 12}     12{col 22} 16.36451{col 34} 1.686195{col 46} 5.841152{col 58} 12.65322{col 70}  20.0758
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     24{col 22} 12.60722{col 34} 1.295355{col 46} 6.345915{col 58} 9.927576{col 70} 15.28687
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22}-7.514575{col 34} 2.109523{col 58}-11.88946{col 70}-3.139691
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res} -3.5622
{txt}Ho: diff = 0                                     degrees of freedom = {res}      22

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.0009         {txt}Pr(|T| > |t|) = {res}0.0017          {txt}Pr(T > t) = {res}0.9991
{txt}
{com}. ttest gain_v, by(c_p_right)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}      8{col 22} 9.644813{col 34} 2.161112{col 46} 6.112548{col 58} 4.534595{col 70} 14.75503
       {txt}1 {c |}{res}{col 12}     12{col 22} 16.36451{col 34} 1.686195{col 46} 5.841152{col 58} 12.65322{col 70}  20.0758
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}     20{col 22} 13.67663{col 34} 1.498765{col 46} 6.702682{col 58} 10.53968{col 70} 16.81358
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22}-6.719695{col 34} 2.714954{col 58} -12.4236{col 70}-1.015789
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res} -2.4751
{txt}Ho: diff = 0                                     degrees of freedom = {res}      18

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.0117         {txt}Pr(|T| > |t|) = {res}0.0235          {txt}Pr(T > t) = {res}0.9883
{txt}
{com}. 
. *Figure 5: Vote Share Increase from One Unit Improve in Parties’ Valence Image
. graph box gain_v if party<7, over(party, sort(1))  ///
> box(1, col(black))  marker(1, mcol(black) mlab(p_year) mlabcol(black) mlabposition(12)) ///
> ytitle("Vote Share Increase", c(black) m(r+3)) ylab(,nogrid) ///
> graphregion(color(white)) bgcolor(white) ///
> title("", c(black) j(right))
{res}{txt}
{com}. graph save Graph "Figure_5.gph" ,replace 
{res}{txt}(file Figure_5.gph saved)

{com}. graph export "Figure_5.png", as(png) replace
{txt}(file Figure_5.png written in PNG format)

{com}. 
. 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}G:\My Drive\ROI\UCDavis\Dissertation\Chapter 2\BJPS\Replication\Stuck_in_the_Middle_simulation_log.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}23 Apr 2019, 15:52:41
{txt}{.-}
{smcl}
{txt}{sf}{ul off}